package com.mingqi.enetconnected.primary.mytask.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingqi.enetconnected.R;
import com.mingqi.enetconnected.primary.mytask.activity.PutTableActivity;

import java.util.List;

/**
 * @author li
 * @version 1.0
 * @describe
 * @WeChat 18571658038
 * @date 2018/9/7 星期五.
 */

public class TableToolAdapter extends BaseQuickAdapter<String,BaseViewHolder> {

    private Context mContext;

    public TableToolAdapter(@Nullable List<String> data, Context context) {
        super(R.layout.item_table_tool_item,data);
        mContext = context;
    }

    @Override
    protected void convert(final BaseViewHolder helper, String item) {

        helper.getView(R.id.tv_editor).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(mContext, PutTableActivity.class);
                mContext.startActivity(intent);
            }
        });

        helper.getView(R.id.tv_change).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(mContext, PutTableActivity.class);
                mContext.startActivity(intent);
            }
        });

        helper.getView(R.id.tv_delete).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Toast.makeText(mContext ,"删除" + helper.getLayoutPosition(), Toast.LENGTH_SHORT).show();
            }
        });
    }
}
